function doesProxyContextMatchUrl(context, url) {
  console.log("context,", context);
  console.log("context[0],", context[0]);
  console.log("url,", url);
  return (
    (context[0] === "^" && new RegExp(context).test(url)) ||
    url.startsWith(context)
  );
}

let context = "^/api";
let url = "/api/static/data.json";
let result = doesProxyContextMatchUrl(context, url);
console.log("result,", result);
console.log(
  "context[0] === " ^ " && new RegExp(context).test(url),",
  context[0] === "^" && new RegExp(context).test(url)
);
